package com.qch.concurrent.demo_01_semaphore;

import java.util.concurrent.Semaphore;

/**
 * @Author qch
 * @Date 2021/8/2
 * Semaphore也就是信号量，提供了资源数量的并发访问控制
 */
public class Main {
    public static void main(String[] args) {
        Semaphore semaphore=new Semaphore(1);
        for (int i = 0; i < 5; i++) {
            new MyThread("学生-"+(i+1),semaphore).start();
        }
    }
}
